<?php

namespace common\models\base;

use Yii;

/**
 * This is the model class for table "{{%base_drug_config}}".
 *
 * @property int $id
 * @property int $drug_id 药品ID
 * @property int $drug_type 使用类型【1静滴、2肌注】
 * @property float $drug_volume 药品容量【单位：ml】
 * @property int $water_type 水类型【1盐水、2糖水 type=1存在】
 * @property int $water_volume 水容量【单位：ml type=1存在】
 * @property int $created_at 创建时间
 * @property int $updated_at 更新时间
 */
class DrugConfig extends \common\models\BaseModel
{
    const DRUG_TYPE_JD = 1;// 静滴
    const DRUG_TYPE_JZ = 2;// 肌注

    const WATER_TYPE_SALT = 1;// 盐水
    const WATER_TYPE_SUGAR = 2;// 糖水

    const WATER_UNIT = 'ml';

    public static $drugTypes = [
        self::DRUG_TYPE_JD => '静滴',
        self::DRUG_TYPE_JZ => '肌注',
    ];

    public static $waterTypes = [
        self::WATER_TYPE_SALT => '盐水',
        self::WATER_TYPE_SUGAR => '糖水',
    ];

    public static $waterPrintTypes = [
        self::WATER_TYPE_SALT => '0.9%的氯化钠溶液',
        self::WATER_TYPE_SUGAR => '葡萄糖注射液',
    ];

    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return '{{%base_drug_config}}';
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['drug_id', 'drug_type', 'water_type', 'water_volume', 'created_at', 'updated_at'], 'integer'],
            [['drug_volume'], 'number'],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'drug_id' => '药品ID',
            'drug_type' => '使用类型【1静滴、2肌注】',
            'drug_volume' => '药品容量【单位：ml】',
            'water_type' => '水类型【1盐水、2糖水 type=1存在】',
            'water_volume' => '水容量【单位：ml type=1存在】',
            'created_at' => '创建时间',
            'updated_at' => '更新时间',
        ];
    }
}
